﻿<?php

$aWidgets = array(
	'url_shortener' => array(
		'file'   => '_url_shortener.php',
		'export' => '/modules/url-shortener/export.php',
		),
    'site_catalog' => array(
		'file'   => '_site_catalog.php',
		'export' => '/modules/site-catalog/export.php',
		),
	'news_grabber' =>array(
		'file'   => '_news_grabber.php',
		'export' => '/modules/news-grabber/export.php',
		),	
);


$aPB = array();
foreach ($aWidgets as $key=>$options) {
	include_once($options['file']);
	$oWidget = new $key();
	$aPB[$key] = $oWidget->getBlock($options['export']);
}



$sTpl = file_get_contents('tpl/layout.php');
foreach ($aPB as $key=>$block) {
	$sTpl = str_replace('{'.$key.'}', $block, $sTpl);
}

echo $sTpl;